package com.ruoyi.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.domain.Fundmanagement;
import com.ruoyi.service.IFundmanagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * FundmanagementController
 * 
 * @author wjy
 * @date 2025-01-11
 */
@RestController
@RequestMapping("/fundmanagement")
public class FundmanagementController extends BaseController
{
    @Autowired
    private IFundmanagementService fundmanagementService;

    /**
     * 查询Fundmanagement列表
     */
    @RequiresPermissions("fundmanagement:fundmanagement:list")
    @GetMapping("/list")
    public TableDataInfo list(Fundmanagement fundmanagement)
    {
        startPage();
        List<Fundmanagement> list = fundmanagementService.selectFundmanagementList(fundmanagement);
        return getDataTable(list);
    }

    /**
     * 导出Fundmanagement列表
     */
    @RequiresPermissions("fundmanagement:fundmanagement:export")
    @Log(title = "Fundmanagement", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Fundmanagement fundmanagement)
    {
        List<Fundmanagement> list = fundmanagementService.selectFundmanagementList(fundmanagement);
        ExcelUtil<Fundmanagement> util = new ExcelUtil<Fundmanagement>(Fundmanagement.class);
        util.exportExcel(response, list, "Fundmanagement数据");
    }

    /**
     * 获取Fundmanagement详细信息
     */
    @RequiresPermissions("fundmanagement:fundmanagement:query")
    @GetMapping(value = "/{fundId}")
    public AjaxResult getInfo(@PathVariable("fundId") Long fundId)
    {
        return success(fundmanagementService.selectFundmanagementByFundId(fundId));
    }

    /**
     * 新增Fundmanagement
     */
    @RequiresPermissions("fundmanagement:fundmanagement:add")
    @Log(title = "Fundmanagement", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Fundmanagement fundmanagement)
    {
        return toAjax(fundmanagementService.insertFundmanagement(fundmanagement));
    }

    /**
     * 修改Fundmanagement
     */
    @RequiresPermissions("fundmanagement:fundmanagement:edit")
    @Log(title = "Fundmanagement", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Fundmanagement fundmanagement)
    {
        return toAjax(fundmanagementService.updateFundmanagement(fundmanagement));
    }

    /**
     * 删除Fundmanagement
     */
    @RequiresPermissions("fundmanagement:fundmanagement:remove")
    @Log(title = "Fundmanagement", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fundIds}")
    public AjaxResult remove(@PathVariable Long[] fundIds)
    {
        return toAjax(fundmanagementService.deleteFundmanagementByFundIds(fundIds));
    }
}
